#set($layout = "blank.html")
<div class="space-4"></div>
<div class="form-group">
	<div class="col-sm-12">
		<form id="setPermissionForm">
			<select multiple="multiple" size="10" name="ids" id="duallist"> #foreach($record in $obj.data.record )
				<option value="$!{record.id}"$!{record.hasr_permission}>$!{record.p_name} $!{record.p_desc}</option> #end
			</select>
			<div class="hr hr-16 hr-dotted"></div>
			<div class="pull-right" style="margin-right:45px">
				<button type="button" class="btn btn-sm btn-primary" onclick="setPermission()">
					<i class="fa fa-save"></i> 提交
				</button>
				<button class="btn btn-sm btn-warning btn-dialog-undo">
					<i class="fa fa-undo"></i> 返回
				</button>
			</div>
			<input type="hidden" id="roleId" name="roleId" value="$!{obj.data.roleId}">
		</form>
	</div>
</div>
<script src="$!{base}/resources/assets/js/jquery.bootstrap-duallistbox.js"></script>
<script>
	$(function($) {
		$('select[name="ids"]').bootstrapDualListbox({
			selectedListLabel:'已选角色',
			nonSelectedListLabel:'全部角色'
		}).bootstrapDualListbox('getContainer').find('.btn').addClass('btn-white btn-info btn-bold');
	});
	function setPermission() {
		console.log($('#setPermissionForm').serialize());
		$.post(getRootPath() + '/role/setPermission', $('#setPermissionForm').serialize(), commonAjaxCallBasck, 'json');
	}
</script>